package com.bsb.base.model;

import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.annotations.TableField;
import com.bsb.base.common.util.StringUtils;

public class SysRole {
    private Long id;

    private String role;

    private String description;

    private String resource_ids;   //菜单
    
    private List<Long> resourceIds;

    private Boolean available = Boolean.FALSE;
    
    private String dept_id;       //所属部门
    @TableField(exist = false)
    private String dept_name;     //所属部门名称
    @TableField(exist = false)
    private String data_dept_ids;  //数据权限，能看到哪些部门的数据
    
    @TableField(exist = false)
    private List<Long> datadeptIds;  

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getResource_ids() {
        return resource_ids;
    }

    public void setResource_ids(String resource_ids) {
        this.resource_ids = resource_ids;
    }

    public Boolean getAvailable() {
        return available;
    }

    public void setAvailable(Boolean available) {
        this.available = available;
    }

	public List<Long> getResourceIds() {
		if(resourceIds == null){
			resourceIds  = new ArrayList<Long>();
		}
		return resourceIds;
	}

	public void setResourceIds(List<Long> resourceIds) {
		if(StringUtils.isEmpty(resource_ids)){
			return;
		}
		String[] split = resource_ids.split(",");
		for (String str : split) {
			if(StringUtils.isEmpty(str)){
				 continue;
			}
			getResourceIds().add(Long.valueOf(str));
		}
	}

	public String getDept_id() {
		return dept_id;
	}

	public void setDept_id(String dept_id) {
		this.dept_id = dept_id;
	}

	public String getData_dept_ids() {
		return data_dept_ids;
	}

	public void setData_dept_ids(String data_dept_ids) {
		this.data_dept_ids = data_dept_ids;
	}

	public String getDept_name() {
		return dept_name;
	}

	public void setDept_name(String dept_name) {
		this.dept_name = dept_name;
	}

	public List<Long> getDatadeptIds() {
		return datadeptIds;
	}

	public void setDatadeptIds(List<Long> datadeptIds) {
		this.datadeptIds = datadeptIds;
	}
    
    
}